<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="HeaderInfo">
   
// GENNIT Castle ActiveRecord http://www.gennit.com
//
// Project: <xsl:value-of select="ProjectName"/>
//
// **************************************************************
// IMPORTANT BIT:
//
// This source code is is owned by you. No copyright is held by
// GENNIT. However, please note the disclaimer below
// **************************************************************
//
// GENNIT refers to the GENNIT website and anyone affiliated
// with the GENNIT system. Including but not limited to
// the administrator and service provider.
//
// Unless agreed to in writing, source code is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. GENNIT are not responsible for 
// your use/misuse of this code.

// When you use GENNIT code, you do so at your own risk and 
// GENNIT is not responsible for the accuracy, 
// reliability or functionality of the code. GENNIT expressly 
// disclaims any potential liability associated with use of 
// this generated code.



using System;

using Castle.ActiveRecord;
using Castle.ActiveRecord.Framework.Config;

using NUnit.Framework;


namespace <xsl:value-of select="ProjectName"/>.Dal.Tests  
{
	<![CDATA[
	/// <summary>
	/// This class provides the base functionality for implementing classes
	/// to test the ActiveRecord classes using NUnit. Class inherits IDisposable
	/// as it implements ActiveRecord SessionScope object which requires disposing.
	/// <see cref="http://www.nunit.org"/>
	/// </summary>
	public abstract class NUnitBase : IDisposable
	{

		

		private SessionScope scope;
		
		
		/// <summary>
		/// SessionScope provides abstract access to the underlying database.
		/// A session scope must exist before ActiveRecord objects can be
		/// used. See ActiveRecord documentation for more information about
		/// session scope.
		/// </summary>
		public SessionScope Scope 
		{
			get 
			{ 
				return scope; 
			}
			set 
			{ 
				scope = value; 
			}
		}
		
		
		
		/// <summary>
		/// Base implementation of setup for a NUnit test. See implementing
		/// classes for its usage.
		/// </summary>
		internal void Setup ()
		{
			scope = new SessionScope();
		}
		
		
		
		/// <summary>
		/// Base implementation of tear down for a NUnit test. See implementing
		/// classes for its usage.
		/// </summary>		
		internal void Teardown ()
		{
			scope.Dispose();
		}
		
		
		
		/// <summary>
		/// Initializes ActiveRecord objects of the parameter types
		/// </summary>
		/// <param name="types">A list of ActiveRecord types to init.</param>
		internal static void TestFixtureSetup ( params Type[] types )
		{
			// ActiveRecord uses the ActiveRecord.xml provided to create
			// a connection to the database. There are other ways to implement
			// this, such as using ConfigurationSettings. See the ActiveRecord
			// documentation for more information.
			XmlConfigurationSource source = 
				new XmlConfigurationSource ( "ActiveRecord.xml" );
			
			ActiveRecordStarter.ResetInitializationFlag ();
			ActiveRecordStarter.Initialize( source ,  types );
		}
		
		
		
		/// <summary>
		/// NUnitBase deconstructor, execute the Dispose method.
		/// </summary>
		~NUnitBase ()
		{
			Dispose ( false );
		}
		
		
		
		/// <summary>
		/// IDisposable implementation of Dispose method.
		/// Dispose of this object by calling Dispose directly
		/// and prevent GC finalization code from executing twice.
		/// </summary>
		public void Dispose ( )
		{
			Dispose(true);
			GC.SuppressFinalize(this);
		}
		
		
		/// <summary>
		/// Dipose method attempts to dispose of this object and 
		/// SessionScope if it has not been disposed already
		/// </summary>
		/// <param name="disposing">true if called directly, 
		/// false if called by the finalizer</param>
		protected virtual void Dispose ( bool disposing )
		{
			if ( disposing )
			{
				try
				{
				    scope.Dispose ( );
				}
				catch ( Castle.ActiveRecord.Framework.Scopes.ScopeMachineryException )
				{
					// Normally the scope will already have been disposed
					// in this case just report to Console (will appear in NUNIT)
					Console.Error.WriteLine ( "Scope already unregistered" );
				}
			}
		}

		


		// The following values are used as test data in associated NUnit
		// tests which implement NUnitBase.
		
		/// <summary>
		/// Test data for a Datetime object set to 23rd July 1980
		/// </summary>
		public static readonly DateTime TestDateTime=new DateTime ( 1980, 07, 23 );
		
		/// <summary>
		/// Test data for a Guid object set to an empty guid.
		/// </summary>		
		public static readonly Guid TestGuid=Guid.Empty;
		
		
		/// <summary>
		/// An example test string. If your system is to support other encoding
		/// types you should modify to include them.
		/// </summary>		
		public const string Teststring="~!@#$%^&;*()_+`1234567890-={}|:\"<>" +
			"?[]\\;',./qwertyuiopasdfghjklxcvbnm,QWERTYUIOPASDFGHJKLZXCVBNM";		
		
		/// <summary>
		/// Test data for a integer set to integer maxiumum value
		/// </summary>
		public const int Testint=int.MaxValue;
		
		/// <summary>
		/// Test data for a double set to double maxiumum value
		/// </summary>		
		public const double Testdouble=double.MaxValue;
		
		/// <summary>
		/// Test data for a float  set to float maxiumum value
		/// </summary>
		public const float Testfloat=float.MaxValue;
		
		/// <summary>
		/// Test data for a bool set to true
		/// </summary>
		public const bool Testbool=true;
		
		
		
		
	
	}


}
	]]>
	</xsl:template>
	
	
</xsl:stylesheet>